<?php
/**
 * +----------------------------------------------------------------------
 * | summer framework
 * +----------------------------------------------------------------------
 * | Copyright (c) 2020 https://github.com/suframe/think-admin All rights reserved.
 * +----------------------------------------------------------------------
 * | Author: summer <806115620@qq.com>  2020/4/19 14:30
 * +----------------------------------------------------------------------
 */
declare (strict_types=1);

namespace app\mall\model\traits;


use app\mall\enum\PayWayEnum;

/**
 * 获取支付方式
 * trait PayWayTrait
 * @package app\mall\model\traits
 * @property string pay_way
 * @property PayWayEnum pay_way_enum
 */
trait PayWayTrait
{

    /**
     * 库存类型名称
     * @return string
     */
    public function getPayWayTextAttr(): string
    {
        return $this->pay_way_enum ? $this->pay_way_enum->getZhName() : '';
    }

    public function getPayWayEnumAttr()
    {
        if (!$this->pay_way) {
            return null;
        }
        return new PayWayEnum($this->pay_way);
    }

}